
function $(obj) {
	return document.getElementsByName(obj)[0];
}
var bankDoc;
var procDoc;
function CreateBank(file) {
    try {
        bankDoc = new ActiveXObject("Microsoft.XMLDOM");
        bankDoc.load(file);
    } catch (e) {
        alert(e);
        try {
            parser = new DOMParser();
            bankDoc = parser.parseFromString(file, "text/xml");
        } catch (e) {
            alert(e);
        }
    }

    bankDoc.onreadystatechange = function() {
        GetAllBank();
    };
}
function GetAllBank() {
	var list = bankDoc.getElementsByTagName("bank");
	$("BankID").length = 0;
	for (var i = 0; i < list.length; i++) {
		bankId = list[i].getAttribute("bankId");
		bankName = list[i].getAttribute("bankName");
		var bankIdOption=new Option(bankName, bankId);
		//默认选中模拟银行
		if ("700"==bankId){
			bankIdOption.selected=true;
		}
		$("BankID").options.add(bankIdOption);
	}
}
function LoadBankXML(file) {
    try {
        bankDoc = new ActiveXObject("Microsoft.XMLDOM");
        bankDoc.load(file);
    }
    catch (e) {
        alert(e);
        try {
            parser = new DOMParser();
            bankDoc = parser.parseFromString(file, "text/xml");
        }
        catch (e) {
            alert(e);
        }
    }
}
function GetBankList(name) {
    var list = bankDoc.getElementsByTagName("bank");
    $(name).length = 0;
    for (var i = 0; i < list.length; i++) {
        bankId = list[i].getAttribute("bankId");
        bankName = list[i].getAttribute("bankName");
        var bankIdOption=new Option(bankName, bankId);
        //默认选中模拟银行
        if ("700"==bankId){
            bankIdOption.selected=true;
        }
        $(name).options.add(bankIdOption);
    }
}
function CreateProc(file) {
	try {
		procDoc = new ActiveXObject("Microsoft.XMLDOM");
		procDoc.load(file);
	}
	catch (e) {
		try {
			parser = new DOMParser();
			procDoc = parser.parseFromString(file, "text/xml");
		}
		catch (e) {
		}
	}
	procDoc.onreadystatechange = function () {
		if (4 == procDoc.readyState) {
			GetProvince();
		}
	};
}
function GetProvince() {
	var list = procDoc.getElementsByTagName("province");
	var province = $("Province");
	province.length = 0;
	$("City").length = 0;
	for (var i = 0; i < list.length; i++) {
		name = list[i].getAttribute("name");
		province.options.add(new Option(name, name));
	}
	GetCity();
}
function GetCity() {
	debugger;
	var list = procDoc.getElementsByTagName("province");
	$("City").length = 0;
	var selP = $("Province").options[$("Province").selectedIndex].value;
	var P;
	for (var i = 0; i < list.length; i++) {
		if (list[i].getAttribute("name") == selP) {
			p = list[i].getElementsByTagName("city");
			for (var j = 0; j < p.length; j++) {
				name = p[j].getAttribute("name");
				$("City").options.add(new Option(name, name));
			}
		}
	}
}

